package com.prime.cn.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class TestController {

    @RequestMapping("/index")
    public String index(){
        System.out.printf("aaaa");
        return "aaalogin";
    }
    @RequestMapping("/fail")
    public String fail(){
        System.out.printf("fail");
        return "fail";
    }
    @RequestMapping("/main")
    public String main(){
        System.out.printf("main");
        return "success";
    }
    @RequestMapping("/unauthorized")
    public String unauthorized(){
        System.out.printf("unauthorized");
        return "unauthorized";
    }
    @RequiresRoles(value={"user"})
    @RequiresPermissions(value={"user:do"})
    @RequestMapping("/info")
    public String info(){
        System.out.printf("info");
        return "info";
    }
    @RequiresRoles(value={"admin"})
    @RequiresPermissions(value={"admin:do"})
    @RequestMapping("/bonus")
    public String bonus(){
        System.out.printf("bonus");
        return "bonus";
    }
}
